package com.ljh.bean;


import com.ljh.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class ConsumerComponent {

    @Reference
    private UserService userService;

    public String getUser(String name) {


        return userService.getUser(name);
    }

    public String getUserA(String name) {

        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userService.getUserA(name);
    }

    public String getUserB(String name) {

        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userService.getUserB(name);
    }

    public String getUserC(String name) {

        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userService.getUserC(name);
    }

}
